package com.wmapp.domain;

import com.wmapp.utils.Pserver;
import com.wmapp.utils.SimpleStringUtils;

/**
 * System administrator domain
 * @author dengl
 *
 */
public class SipAccount {	
	private String account;
    private String protocol;
	private String enabled;
	private String password;
	private String username;
	private String authname;
	private String registrar;
	private String domain;
	private String registered;
    private String description;
    private String reason;

	public static final String[] ADD_PARAM_FIELDS={"account","protocol","enabled","password","username","authname","registrar","domain","description"};
	public static final String[] MODIFY_PARAM_FIELDS={"account","protocol","enabled","password","username","authname","registrar","domain","description"};
	public static final String[] GRID_COLS={"account","enabledStatus","username","authname","registrar","domain","registered", "reason"};
	
	public String getAccount() {
		return account;
	}
	public void setAccount(String account) {
		this.account = account;
	}

    public String getProtocol() {
		return protocol;
	}
	public void setProtocol(String protocol) {
		this.protocol = protocol;
	}

    public String getEnabledStatus() {
		if( enabled == null)
            return "0";
        if( enabled.equals("true") || enabled.equals("yes") || enabled.equals("enable") )
            return "1";
        else
            return "0";
	}
	public String getEnabled() {
		return enabled;
	}
    public void setEnabled(String enabled) {
		this.enabled = enabled;
	}
    public String getUsername() {
		return username;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public String getAuthname() {
		return authname;
	}
	public void setAuthname(String authname) {
		this.authname = authname;
	}
	public String getRegistrar() {
		return registrar;
	}
	public void setRegistrar(String registrar) {
		this.registrar = registrar;
	}
	public String getDomain() {
		return domain;
	}
	public void setDomain(String domain) {
		this.domain = domain;
	}
	
	public String getRegistered() {
		StringBuffer ret=new StringBuffer();
		if(registered!=null && registered.equals("true")){//registered
			ret.append(SimpleStringUtils.join("<span title='$img.tip.registed'><img src='",Pserver.getInstance().getContextPath(),"/styles/default/images/accept.png' /></span>"));
		}
		return ret.toString();
	}
	public void setRegistered(String registered) {
		this.registered = registered;
	}

    public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}

    public String getReason() {
		return reason;
	}
	public void setReason(String reason) {
		this.reason = reason;
	}
}
